<template lang="">
    <div>
                  <!-- 面包屑导航 -->
                    <el-bread></el-bread>
  <!-- 添加按钮 -->
     <el-button type="primary" plain class="add" size="small" @click="addlogin">添加</el-button>


    <!-- 列表的渲染 -->
    <v-list  @edit = 'edit'></v-list>

    <!-- 弹框组件 -->
    <v-dialog ref="diaInfo" :isShow = "isShow"  :isAdd = 'isAdd'  @cancel="cancel"></v-dialog>

    </div>
</template>
<script>
import vList from './list.vue'
import vDialog from './dialog.vue'
export default {
    data() {
        return {
            isShow: false,//用于控制弹框的显示隐藏
            isAdd: true,//用于控制编辑弹框的显示隐藏
        }
    },
    components: {
        vList,
        vDialog
    },
    methods: {
        // 子控制父  去关闭弹窗
        cancel(e) {
            this.isShow = e
        },
        // 点击添加弹框显示
        addlogin() {
            this.isShow = true
            //告诉弹框你是新增
            this.isAdd = true
        },
        edit(e) {
            // 打开弹窗
            this.isShow = true
            //告诉弹框你是编辑
            this.isAdd = false
            this.$refs.diaInfo.lookup(e)
        }
    },
}
</script>

<style lang="less" scoped>
.add {
    margin-top: 20px;
}
</style>
